with Ada.Text_IO; use Ada.Text_IO;
package body Stations is

   protected body Station is

      procedure create(Station: StationType) is
      begin
         name:=Station;
      end;

      procedure comeTrain is
      begin
         trainInStation:=true;
         Put_Line("Train come to station: "&getName);

         if not queue.Is_Empty then
            for i in queue.First_Index..queue.Last_Index loop
               Put_Line("Passenger "&PassengerId'Image(queue.Element(Index => i))&" in train");
            end loop;

         end if;
      end;

      procedure leaveTrain(q: in out Passengers_Container.Vector) is
      begin

         trainInStation:=false;

         Put_Line("Train leave station: "&getName);

         q:=queue;
         queue.Clear;

      end;

      function getName return String is
      begin
         return StationType'Image(name);
      end;

      function isTrain return Boolean is
      begin
         return trainInStation;
      end;

      procedure add(id: PassengerId) is
      begin

         if isTrain then
            Put_Line("Passenger "&Integer'Image(id)&" in train");
            queue.Append (New_Item => id);
         else
            queue.Append (New_Item => id);
         end if;
      end;


   end Station;



end Stations;




